package com.info.zhiduoduo.alipay.constant;

import com.info.zhiduoduo.common.constants.EnumFindHelper;

/**
 * 支付安全发用户协议签约状态
 * <p> 与zdd_maker_alipay_agreement表中的status字段一一对应
 */
public enum AlipayAgreementStatusEnum {

	TEMP(1, "TEMP","暂存"),
	NORMAL(2,"NORMAL", "正常"),
	STOP(3, "STOP","暂停"),
	;

	public int id;
	public String code;
	public String name;

	AlipayAgreementStatusEnum(int id, String code, String name) {
		this.id = id;
		this.code = code;
		this.name = name;
	}

	//####################################### 方便查找枚举值的方法 ###################################//

	static final EnumFindHelper<AlipayAgreementStatusEnum, Integer> IdHelper = new EnumFindHelper<>(AlipayAgreementStatusEnum.class, e -> e.id);

	static final EnumFindHelper<AlipayAgreementStatusEnum, String> CodeHelper = new EnumFindHelper<>(AlipayAgreementStatusEnum.class, e -> e.code);

	public static AlipayAgreementStatusEnum findById(int id) {
		return IdHelper.find(id, TEMP);
	}

	public static AlipayAgreementStatusEnum findByCode(String name) {
		return CodeHelper.find(name, TEMP);
	}
}
